export default function (id, data, viewList, viewMap) {
    function dynamicLoadCss(url) {
        var head = document.getElementsByTagName('head')[0];
        var link = document.createElement('link');
        link.type = 'text/css';
        link.rel = 'stylesheet';
        link.href = url;
        head.appendChild(link);
    }

    function dynamicLoadJs(url) {
        if (!window.layui) {
            var head = document.getElementsByTagName('head')[0];
            var script = document.createElement('script');
            script.src = url;
            head.appendChild(script);
        }
    }

    dynamicLoadCss("https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/css/bootstrap.min.css")
    dynamicLoadJs("https://unpkg.com/qiniu-js@2.5.4/dist/qiniu.min.js")
    let style = `
                <style>
                  .wrap{
                    width: 100%;
                    height: 100%;
                    float: right;
                    position: relative;
                  }
                  .createUser{
                    width: 100%;
                    padding-left: 8%;
                    box-sizing: border-box;
                    position: absolute;
                    background: white;
                    margin: auto;
                    left: 0;
                    right: 0;
                  }
                  .storeForm{
                    width: 95%;
                    margin: 0 auto;
                    border: 2px solid #ebebeb;
                    overflow: hidden;
                    padding-bottom: 50px;
                  } 
                </style>
                `
    // language=HTML
    let html = `
                <div id="root" style="width: 100%;height: 100%">${viewList[0]}</div>
                `;

    return (`<div id="${id}" style="width: 100%;height: 100%;">${style}${html}</div>`);
}